﻿using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Threading.Tasks;
using System;
using test.demo.Model.WM仓储管理;
using wangyaxin.Jiangzhenying.ProductSalse.Dto;
using wangyaxin.Wang.Dto;
using wangyaxin.Jiangzhenying;

namespace wangyaxin.Web.Jiangzhenying
{
    public class ProductSalseController : Controller
    {
        private readonly ProductSalseService _service;
        public ProductSalseController(ProductSalseService service)
        {
            _service = service;
        }

        public IActionResult ShowProductSalseView()
        {
            return View();
        }
        public IActionResult AddProductSalseView()
        {
            return View();
        }
        public IActionResult UpdateProductSalseView()
        {
            return View();
        }

        [HttpGet]
        public IActionResult ShowProductSalses(string? salseCode, string? soCode, string? clientName)
        {
            var prodectSalse = _service.ShowProductSalse(salseCode, soCode, clientName);
            return Ok(prodectSalse);
        }

        [HttpGet]
        public IActionResult AddProductSalses(WM_Product_Salse input)
        {
            var productSalse = _service.AddProductSalse(input);
            return Ok(productSalse);
        }

        [HttpGet]
        public IActionResult DeletProductSalses(int id)
        {
            var productSalse = _service.DeletProductSalse(id);
            return Ok(productSalse);
        }

        [HttpGet]
        public IActionResult GetProductSalses(int id)
        {
            var productSalse =_service.GetProductSalse(id);
            return Ok(productSalse);
        }

        [HttpGet]
        public IActionResult UpdateProductSalses(UpdateProductSalseDto input)
        {
            var productSalse = _service.UpdateProductSalse(input);
            return Ok(productSalse);
        }
    }
}
